Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uniformtext and enable coloraxis for sunburst and treemap as well as pathbar.textfont #4444

Merged
merged 16 commits into from
Jan 6, 2020

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 26, 2019

Resolves #4443 by adding coloraxis to sunburst and treemap
and fixes uniformtext scale issues with react (follow up of #4420):

  • clear previous uniformtext scale before starting each plot type.
  • fix uniformtext after switching levels when there is no transition for sunburst and treemap
  • fix tests and add new tests for uniformtext as well as new coloraxis feature.

Also:

demo treemap
demo sunburst
demo bar

@plotly/plotly_js

- fix clear previous uniformtext scale before each plot
- fix uniformtext after switch level when has no transition for sunburst and treemap
- fix tests and add new tests
@archmoj archmoj added bug something broken feature something new status: reviewable labels Dec 26, 2019
@archmoj archmoj added this to the v1.52.0 milestone Dec 26, 2019
@@ -91,6 +91,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
gap: fullLayout.bargap,
groupgap: fullLayout.bargroupgap
};

// don't clear bar when this is called from waterfall or funnel
clearMinTextSize('bar', fullLayout);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait. Here you're clearing the min-text-size stash during the plot step. So what's happens when a style-only edit (e.g. Plotly.restyle(gd, 'marker.color', 'red')) gets called?

To me, this logic should probably be somewhere in the calc step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restyle works. Considering interactions (e.g. zoom and selection) this should be cleared after calc and at the stat of plot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering interactions (e.g. zoom and selection) this should be cleared after calc and at the stat of plot.

Can you explain a bit more here? To me, sounds like we should not clear minTextSize during zoom interactions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or let me rephrase my question: if you do move clearMinTextSize to the calc step, do any of the tests fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In that case the react tests would fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share the branch you used to test that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summing up a private convo:

  • I was under the impression that the uniformtext attributes were editType: 'calc', so that's why I thought it would be best to clear the min-text-size during the calc step, but they're not. The uniformtext attributes are editType: 'plot'.
  • @archmoj says that making the uniformtext attributes editType: 'calc' would have an impact on the way graph with set uniformtext would behave on zoom
  • Since we'll need to refactor the trace text pipeline at some point (more info in Consistent text mode for bar-like & pie-like traces and feature to control text orientation inside pie/sunburst slices #4420 (comment)), let's keep the clear-min-text logic in the plot step for now.
  • The most important of this PR are the newly added tests.

function transition(selection, opts, makeOnCompleteCallback) {
if(hasTransition(opts)) {
function transition(selection, fullLayout, opts, makeOnCompleteCallback) {
if(!fullLayout.uniformtext.mode && hasTransition(opts)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I thought you said this transitions looked fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They did not apply a uniform text size during and after smooth transition.

@archmoj archmoj changed the title Fix uniformtext and enable coloraxis for sunburst and treemap Fix uniformtext and enable coloraxis for sunburst and treemap as well as pathbar.textfont Dec 30, 2019
@@ -141,7 +141,9 @@ module.exports = function drawAncestors(gd, cd, entry, slices, opts) {
s.attr('data-notex', 1);
});

var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font, trace.pathdir));
var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font, {
onPathbar: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this commit made three existing mocks change (treemap_level-depth, treemap_packings and treemap_textposition) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question.
And a bad mistake here.
There is no such a thing as pathdir!
It should have been written pathbar.

@archmoj
Copy link
Contributor Author

archmoj commented Jan 5, 2020

After a9c9589 this PR is now ready to go.

@archmoj
Copy link
Contributor Author

archmoj commented Jan 6, 2020

Here is info related to new/modified baselines:
textangle bug fix (#4456):

  • (mod) funnel_axis_textangle
  • (mod) funnel_axis_textangle_start-end
  • (new) bar-like_textangle45
  • (new) bar-like_textangle60

treemap trace custom fonts bug fix (#4451)

  • (new) treemap_fonts_nocolor
  • (new) treemap_fonts_withcolor
  • (mod) treemap_packings
  • (mod) treemap_textposition
  • (mod) uniformtext_sunburst_treemap

treemap coloraxis with values as well as custom fonts and uniformtext (#4443):

  • (new) uniformtext_treemap

uniform start/end anchor positions in respect to (#4247):

  • (mod) niformtext_bar_edgecase2 - text positioned with an identical pad from the top of the bar
  • (mod) uniformtext_bar_edgecase3 - text positioned with an identical pad from the top of the bar
  • (new) uniformtext_bar_edgecase4 - text positioned with an identical pad from the bottom of the bar
  • (new) uniformtext_bar_edgecase5 - text positioned with an identical pad from the bottom of the bar - case of tilted text
  • (new) uniformtext_bar_edgecase5 - text positioned with an identical pad from the bottom of the bar - case of vertical text on vertical bars
  • (new) uniformtext_bar_edgecase6 - text positioned with an identical pad from the bottom of the bar - case of horizontal text on horizontal bars
  • (new) uniformtext_bar_edgecase6 - text positioned with an identical pad from the bottom of the bar - case of tilted text on horizontal bars
  • (new) uniformtext_bar_axis_textangle_inside - inside text positioned with an identical pad in different axis orientations
  • (new) uniformtext_bar_axis_textangle_outside - inside text positioned with an identical pad in different axis orientations

modified mock: middle anchors is not used now that the text positions properly by default

  • (mod) uniformtext_bar-like_10_auto
  • (mod) uniformtext_bar-like_8_horizontal
  • (mod) uniformtext_bar-like_8_textangle
  • (mod) uniformtext_bar-like_8_textangle45

@etpinard
Copy link
Contributor

etpinard commented Jan 6, 2020

💃 💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken feature something new
Projects
None yet
2 participants